<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/11/12
 * Time: 18:16
 */

namespace Modules\Api\Http\Controllers;

use Illuminate\Http\Request;
use Modules\Api\Service\FeedbackService;
use HiCommon\Service\MessageServce;
use HiCommon\Service\PublicService;
class FeedbackController extends BaseController
{

    /**
     *  添加意见反馈
     *  hinq 2019 11 13
     *
     **/
    public function store( Request $request ){
        $arr_input = (array) $request->all();
        $arr_list = FeedbackService::store( (array) $arr_input );
        return response_json( $arr_list );
    }

    /**
     *  获取用户协议列表
     *  hinq 2019 11 13
     *
     **/
    public function protocol_list(){
        $arr_list = FeedbackService::protocol_list();
        return response_json( $arr_list );
    }

    /**
     *  获取用户协议列表
     *  hinq 2019 11 13
     *
     **/
    public function get_list( Request $request ){
        $arr_search = (array) $request->all();
        $arr_list = FeedbackService::protocol_get_list( (array) $arr_search );
        return response_json( $arr_list );
    }



    /**
     *  获取用户协议详情
     *  hinq 2019 11 13
     *
     **/
    public function protocol_detail( Request $request ){
        $nId = (int) $request->get('id');
        return FeedbackService::protocol_detail( (int) $nId );
    }

    /**
     *  获取隐私政策详情
     *  hinq 2019 11 13
     *
     **/
    public function protocol_policy(){
        return FeedbackService::protocol_policy();
    }

    /**
     *  关于信达
     *  hinq 2019 11 13
     *
     **/
    public function about(){
        return FeedbackService::about();
    }

    /**
     *  获取收藏夹收藏列表
     *  hinq 2019 11 13
     *
     **/
    public function collect( Request $request ){

        $arr_input = (array) $request->all();
        $arr_list = FeedbackService::collect( (array) $arr_input );
        return response_json( $arr_list );
    }

    /**
     *	邀请页面数据
     *	hinq 2019 11 13
     *	使用场景【 个人中心 邀请有礼】
     **/
    public function invite(){
        $user_id = api_user_id();
        $arr_list = FeedbackService::get_info( $user_id );
        return response_json( $arr_list );
    }

    /**
     *  获取指定用户的邀请用户列表
     *  hinq 2020 6 11
     *
     **/
    public function invite_list(){
        $user_id = api_user_id();
        return FeedbackService::invite_list( (int) $user_id );
    }

    /**
     *	点击收藏功能
     *	hinq 2019 11 13
     *
     **/
    public function create_collect( Request $request ){
        $arrInput = (array) $request->all();
        $arr_list = FeedbackService::add_collect( (array) $arrInput );
        return response_json( $arr_list );
    }

    /**
     *	删除收藏
     *	hinq 2019 09 07
     *
     **/
    public function del_collect( Request $request  ){
        $arr_input = (array)$request->all();
        $arr_list = FeedbackService::del_collect( (array) $arr_input );
        return response_json( $arr_list );
    }

    /**
     *  门店加盟
     *  hinq 2019 11 13
     *
     **/
    public function join(){
        $arr_list = FeedbackService::road_rescueget_join();
        return response_json( $arr_list );
    }

    /**
     *  道路救援
     *  hinq 2019 11 15
     *
     **/
    public function road_rescue(){
        $arr_list = FeedbackService::road_rescue();
        return response_json( $arr_list );
    }

    /**
     *  添加系统消息
     *  hinq 2019 12 02
     *
     **/
    public function add_message( Request $request ){
        $arr_input = (array) $request->all();
        $arr_list = add_message( (array) $arr_input );
        return response_json( $arr_list );
    }

    /**
     *  获取指定用户的系统消息
     *  hinq 2019 12 02
     *
     **/
    public function get_message( Request $request ){
        $arr_input = $request->all();
        $arr_list = MessageServce::get_message( (array) $arr_input );
        return response_json( $arr_list );
    }


    /**
     *  修改指定的类型或指定数据的阅读状态
     *  hinq 2019 12 03
     *
     **/
    public function change_message( Request $request ){
        $arr_input = (array) $request->all();
        $arr_list = MessageServce::change_message( (array) $arr_input );
        return response_json( $arr_list );
    }

    /**
     *  统计当前用户的消息数量
     *  hinq 2020 5 18
     *
     **/
    public function count_message(){
        return MessageServce::get_message_count();
    }


    /**
     *  添加评论信息
     *  hinq 2020 1 6
     *
     **/
    public function apprise_create( Request $request ){
        $arr_input = (array) $request->all();
        $arr_list = MessageServce::apprise_create( (array) $arr_input );
        return response_json( $arr_list );
    }



    /**
     *  获取指定门店下的所有评论数据
     *  hinq 2020 3 24
     *
     **/
    public function get_shop_apprise( Request $request ){
        $arr_input = (array) $request->all();
        $arr_list = MessageServce::get_shop_apprise( (array) $arr_input );
        return response_json( $arr_list );
    }

    /**
     *  按条件获取指定评论列表信息
     *  hinq 2020 1 6
     *
     **/
    public function get_apprise_list( Request $request ){
        $arr_input = (array) $request->all();
        $arr_list = MessageServce::apprise_list( (array) $arr_input );
        return response_json( $arr_list );
    }


    /**
     *  获取注册礼包的详细数据
     *  hinq 2020 3 10
     *
     **/
    public function gift_regist(){
        $arr_list = FeedbackService::gift_regist();
        return response_json( $arr_list );
    }

    /**
     *  发放新用户注册礼包
     *  hinq 2020 3 10
     *
     **/
    public function send_gift_regist( Request $request ){
        $user_id = (int) $request->get('user_id');
        $arr_list = PublicService::send_gift_regiset( (int) $user_id );
        return response_json( $arr_list );
    }

    /**
     *  发放邀请礼包
     *  hinq 2020 3 10
     *
     **/
    public function send_gift_invite( Request $request){
        $arr_input = (array) $request->all();
        $arr_list = PublicService::send_gift_invite_after(  $arr_input['user_id'] , (int) $arr_input['to_user_id'] );
        return response_json( $arr_list );
    }

    /**
     *  发放老用户回馈礼包
     *  hinq 2020 3 10
     *
     **/
    public function send_gift_old(){
        $arr_list = PublicService::send_gift_old( (int) 9 );
        return response_json( $arr_list );
    }

    /**
     *  会员升级发放升级礼包
     *  hinq 2020 3 10
     *
     **/
    public function send_upgrade_material_benefits(){
        $arr_list = PublicService::send_upgrade_material_benefits( (int) 107 );
        return response_json( $arr_list );
    }

    /**
     *  修改用户的积分（添加、减少） 【给用户添加、扣除积分的唯一入口】
     *  hinq 2020 3 10
     *
     **/
    public function user_integral_change( Request $request){
        $arr_input = (array) $request->all();
        $arr_list = PublicService::user_integral_change( (array) $arr_input );
        return response_json( $arr_list );
    }

    /**
     *  订单结算优惠券补贴价格
     *  hinq 2020 3 10
     *
     **/
    public function order_settlement_amount( Request $request){
        $arr_input = (array) $request->all();
        $arr_list = PublicService::order_settlement_amount3( (array) $arr_input );
        return response_json( $arr_list );
    }


    /**
     *  同一订单多商品的评论
     *  hinq 2020 3 26
     *
     **/
    public  function apprise_create_more( Request $request ){
        $arr_input = (array) $request->all();
        $arr_list = MessageServce::apprise_create_more( (array) $arr_input );
        return response_json( $arr_list );
    }


    /**
     *  获取指点商品的评论列表
     *  hinq 2020 3 26
     *
     **/
    public function apprise_to_goods( Request $request ){
        $arr_input = (array) $request->all();
        $arr_list = MessageServce::apprise_to_goods( (array) $arr_input );
        return response_json( $arr_list );
    }


    /**
     *  获取VIP升级协议
     *  hinq 2019 11 13
     *
     **/
    public function protocol_vip(){
        return FeedbackService::protocol_vip();
    }



}